import request from '@/utils/request'
import qs from 'qs'

// 考试结束无结果
//list
export function checkAnswer(query, provinceIds) {
    return request({
        url: `tools-checkanswer/checkAnswer/list`,
        method: 'get',
        params: query,
        paramsSerializer: () => {
            return qs.stringify({ provinceIds: provinceIds }, { indices: false })
        }
    })
}
// 获取省份
export function getProvince(query) {
    return request({
        url: 'tools-checkanswer/checkAnswer/listProvince',
        method: 'get',
        params: query
    })
}
// 查看MQ
export function cheackMq(studentId, subjectId) {
    return request({
        url: `tools-checkanswer/searchFromMq?studentId=${studentId}&subjectId=${subjectId}`,
        method: 'get',
    })
}
// 查看日志
export function cheackJournal(paperId, studentId, subjectId) {
    return request({
        url: `tools-checkanswer/searchFromLog/${studentId}/${paperId}/${subjectId}`,
        method: 'get',
    })
}
// 导出日志答案
export function exportJournal(paperId, studentId, subjectId, pcNo) {
    return request({
        url: `tools-checkanswer/exportFromLog/${studentId}/${paperId}/${subjectId}/${pcNo}`,
        method: 'get',
        responseType: 'blob'
    })
}
// 标记答案为正常
export function changeMQ(status, studentId, subjectId) {
    return request({
        url: `tools-checkanswer/markAsNormal?status=${status}&studentId=${studentId}&subjectId=${subjectId}`,
        method: 'post',
    })
}
// 处理异常
export function updateUnusual(status, studentId, subjectId) {
    return request({
        url: `tools-checkanswer/updateAnswerSource?status=${status}&studentId=${studentId}&subjectId=${subjectId}`,
        method: 'post',
    })
}
// 检查答案总进度
export function currentCheckTips() {
    return request({
        url: 'tools-checkanswer/currentCheckTips',
        method: 'get',
    })
}
// DB上传oss
export function downloadDb() {
    return request({
        url: 'tools-checkanswer/uploadDb',
        method: 'post',
    })
}


// 考试中
export function listExamIng(query, provinceIds) {
    return request({
        url: 'tools-checkanswer/checkAnswer/listExamIng',
        method: 'get',
        params: query,
        paramsSerializer: () => {
            return qs.stringify({ provinceIds: provinceIds }, { indices: false })
        }
    })
}

// 离线管理
// 搜索考点
export function getJifang(jifang) {
    return request({
        url: `/tools-render/getJifang/${jifang}`,
        method: 'get',
    })
}
// 搜索机房
export function getKaodian(kaodian) {
    return request({
        url: `/tools-render/getKaodian/${kaodian}`,
        method: 'get',
    })
}
// 搜索科目
export function getSubject(subject) {
    return request({
        url: `/tools-render/getSubject/${subject}`,
        method: 'get',
    })
}
// 查询
export function searchOffline(query) {
    return request({
        url: '/tools-render/seek',
        method: 'get',
        params: query
    })
}
// 标位离线   取消离线
export function markOffline(subjectName, zkzNum) {
    return request({
        url: `/tools-render/mark?subjectName=${subjectName}&zkzNum=${zkzNum}`,
        method: 'get',
    })
}
export function cancelMarkOffline(subjectName, zkzNum) {
    return request({
        url: `/tools-render/cancelMark?subjectName=${subjectName}&zkzNum=${zkzNum}`,
        method: 'get',
    })
}
// 批量标为离线
export function markAll(query) {
    return request({
        url: `/tools-render/markAll`,
        method: 'put',
        data: query
    })
}


// 考试结束无日志
// 
export function listLogsNotFind(query) {
    return request({
        url: '/tools-checkanswer/listLogsNotFind',
        method: 'get',
        params: query
    })
}
// 搜索考点
export function searchExamRoom(key) {
    return request({
        url: `/tools-checkanswer/searchCommonExamRoom?key=${key}`,
        method: 'get',
    })
}